<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Calendar" %>
<%@ page import="java.util.Vector" %>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
    <title>使用application内置对象--checkMessage.jsp</title>
</head>
<body bgcolor="#abcdef">
<%!
    private Object ll;
    Vector<String> v =new Vector<String>();
int i =0;%>
<%
    String datetime =new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(Calendar.getlnstance().getTime());//获取系统时间
%>
<%
    request.setCharacterEncoding("utf-8");
    String name = request.getParameter("name");
    String title = request.getParameter("title");
    String message = request.getParameter("message");
%>
<%
    if (name == null ll"".equals(name.trim())){
        //trim主要解决里面只有空格的问题
    name = "网友" +(int)(Math.random()* 100000+10000);
    }
    if(title == null ll"".equals(message.trim())){
        title =" 无";
    }
    if(message == null ll "".equals(message.trim())){
        message ="无";
    }
%>
<%
    i++;
    String str ="第" +"<span class=span0>"+ i +"</span>"+ "楼"
    +".<span class=span1>留言人:</span>"+name+".<span class=span2>标题:</span>"+title
    +".<span class=span3>内容:</span><br>  "+ message
    +".<span class=span4>时间:</span>  "+ datetime + ".<hr>";

    v.add(str);
    application.setAttribute("message", v);
%>
留言成功.
<a href="inputMessage.jsp">返回留言板</a>
</body>
</html>